<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/7/23
 * Time: 14:52
 */
namespace app\jujin\controller;

use controller\JunjinAdmin;
use think\Db;
use think\view\driver\Think;

class Earnest extends JunjinAdmin
{
    public $table='Earnest';

    public function index()
    {
        $this->title = '保证金管理';
        $get = $this->request->get();
        $db = Db::name($this->table);
        if (isset($get['create_at']) && $get['create_at'] !== '') {
            list($start, $end) = explode(' - ', $get['create_at']);
            $db->whereBetween('create_at', [strtotime("{$start} 00:00:00"), strtotime("{$end} 23:59:59")]);
        }
        return parent::_list($db->order('id desc'));
    }
    protected function _form_filter(&$data)
    {
        if($this->request->isGet()){
            if($this->request->get('id')){
                $this->title='编辑保证金信息';
            }else{
                //这个暂时不存在
                $this->title='添加保证金信息';
            }
        }else{
            //处理数据
        }
    }

}